home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / prog_gen / guslib.zip / PLAYVOC.ASM < prev    next >
Assembly Source File  |  1994-08-26  |  7KB  |  280 lines

  1.          dosseg
  2.          ideal
  3.          model large
  4.          p286
  5.          jumps
  6.          include "guslib.inc"
  7.          stack 2048
  8.  
  9.          dataseg
  10. data                 db    4864 dup (00h)
  11. file                 db    'bummer.snd',0
  12. file_size_high       dw    0000h
  13. file_size_low        dw    0000h
  14. gfh                  dw    0000h
  15. psp_seg              dw    0000h
  16. msg1_command_line    db    'Sound Player - By Paul Kimbrel - 5/31/1994',13,10
  17.                      db    'Plays back .VOC files to Gravis UltraSound sound cards',13,10,10
  18.                      db    'Usage:  GUS <sound file>',13,10,10
  19.                      db    '        <sound file>   Any .VOC file (include directory'
  20.                      db    ' if necessary)',13,10,10,'$'
  21. msg2_fnf             db    13,10,7,'Warning!  File not found!',13,10,10,'$'
  22. msg3_no_env          db    7,'UltraSound environmental variable not found or not correct!',13,10
  23.                      db    'Make sure you have your SET ULTRASND= line in your autoexec.bat file.',13,10
  24.                      db    'For information on setting the variable, please refer to your GUS manual.$'
  25. msg4_bad_gus         db    7,'UltraSound failed to respond!$'
  26. msg5_keybreak        db    7,'DownLoad_Sound - DMA canceled by keybreak!$'
  27. buffer_seg           dw    0000h
  28. lc                   db       '0'
  29.  
  30.  
  31.          codeseg
  32. proc     main     far
  33.          mov      ax,dgroup
  34.          mov      ds,ax
  35.          mov      [psp_seg],es
  36.          mov      bx,stack
  37.          sub      bx,playvoc_text
  38.          add      bx,1024
  39.          mov      ah,4ah
  40.          int      21h
  41.          jc       doneman
  42.          call     get_fn
  43.  
  44.          mov      ax,[file_size_low]
  45.          mov      dx,[file_size_high]
  46.          mov      bx,16
  47.          idiv     bx
  48.          inc      ax
  49.          mov      bx,ax
  50.          mov      ah,48h
  51.          int      21h
  52.          jc       doneman
  53.          mov      [buffer_seg],ax
  54.          call     load_fn
  55.  
  56.          call     start_GUS
  57.  
  58.          mov      ax,0
  59.          mov      bx,Play_Voice
  60.          call     guslib
  61.  
  62. key_lp1: mov      ah,6
  63.          mov      dl,0ffh
  64.          int      21h
  65.          jnz      key_hit
  66.          mov      bx,Voice_Status
  67.          mov      al,0
  68.          call     guslib
  69.          cmp      ax,0
  70.          jz       key_lp1
  71.          jmp      no_key
  72. key_hit: mov      bx,Stop_Voice
  73.          mov      al,0
  74.          call     guslib
  75.  
  76. no_key:  mov      al,00h
  77.          jmp      doneman
  78. endp     main
  79.  
  80. proc     start_gus   far
  81.          mov      bx,Init_GUS
  82.          call     guslib
  83.  
  84.          cmp      ax,0
  85.          jz       init_ok
  86.          cmp      ax,4
  87.          jnc      nbe
  88.          mov      ah,9
  89.          mov      dx,offset msg3_no_env
  90.          int      21h
  91.          mov      al,3
  92.          jmp      doneman
  93. nbe:     mov      ah,9
  94.          mov      dx,offset msg4_bad_gus
  95.          int      21h
  96.          mov      al,4
  97.          jmp      doneman
  98. init_ok: mov      al,14
  99.          mov      bx,Set_Active
  100.          call     guslib
  101.  
  102.          mov      ax,[buffer_seg]
  103.          mov      es,ax
  104.          mov      cl,1
  105.          mov      di,0
  106.          mov      si,0
  107.          mov      dx,[file_size_high]
  108.          mov      ax,[file_size_low]
  109.          dec      ax
  110.          mov      bx,Download_Sound
  111.          call     guslib
  112.  
  113.          cmp      ax,0
  114.          jz       kok
  115.          mov      ah,9
  116.          mov      dx,offset msg5_keybreak
  117.          int      21h
  118.          mov      al,5
  119.          call     doneman
  120. kok:     mov      bx,Set_Volume
  121.          mov      cl,0
  122.          mov      ax,4095
  123.          call     guslib
  124.  
  125.          mov      ax,[buffer_seg]
  126.          mov      es,ax
  127.          xor      ax,ax
  128.          mov      al,[byte es:1eh]
  129.          mov      bx,256
  130.          sub      bx,ax
  131.          mov      ax,4240h
  132.          mov      dx,0fh
  133.          idiv     bx
  134.          mov      cl,0
  135.          mov      bx,Set_Freq
  136.          call     guslib
  137.  
  138.          mov      al,3
  139.          mov      cl,0
  140.          mov      bx,Set_Loop
  141.          call     guslib
  142.          mov      dx,0
  143.          mov      ax,0
  144.          mov      cl,0
  145.          mov      bx,Set_Start
  146.          call     guslib
  147.  
  148.          mov      dx,[file_size_high]
  149.          mov      ax,[file_size_low]
  150.          mov      cl,0
  151.          mov      bx,Set_End
  152.          call     guslib
  153.  
  154.          ret
  155. endp     start_gus
  156.  
  157. proc     load_fn  far
  158.          push     es
  159.          mov      cx,[file_size_high]
  160.          mov      bx,[file_size_low]
  161.          mov      dx,[buffer_seg]
  162.          cmp      cx,0
  163.          jz       last_part
  164. rd_lp1:  mov      es,dx
  165.          push     bx cx dx
  166. ;
  167.          mov      bx,[gfh]
  168.          mov      cx,65535
  169.          mov      dx,0
  170.          push     ds
  171.          mov      ax,[buffer_seg]
  172.          mov      ds,ax
  173.          mov      ah,3fh
  174.          int      21h
  175.          pop      ds
  176. ;
  177.          mov      bx,[gfh]
  178.          mov      cx,1
  179.          mov      dx,65535
  180.          push     ds
  181.          mov      ax,es
  182.          mov      ds,ax
  183.          mov      ah,3fh
  184.          int      21h
  185.          pop      ds
  186. ;
  187.          pop      dx cx bx
  188.          add      dx,1000h
  189.          dec      cx
  190.          jnz      rd_lp1
  191. last_part:
  192.          mov      es,dx
  193.          mov      cx,bx
  194.          mov      bx,[gfh]
  195.          mov      dx,0
  196.          push     ds
  197.          mov      ax,es
  198.          mov      ds,ax
  199.          mov      ah,3fh
  200.          int      21h
  201.          pop      ds
  202.          pop      es
  203.          ret
  204. endp     load_fn
  205.  
  206. proc     doneman  far
  207.          push     ax
  208.          cmp      [gfh],0
  209.          jz       nfo
  210.          mov      ah,3eh
  211.          mov      bx,[gfh]
  212.          int      21h
  213. nfo:     cmp      [buffer_seg],0
  214.          jz       nda
  215.          mov      ax,4900h
  216.          push     es
  217.          mov      bx,[buffer_seg]
  218.          mov      es,bx
  219.          int      21h
  220.          pop      es
  221. nda:     mov      bx,Deinit_GUS
  222.          call     guslib
  223.          pop      ax
  224.          mov      ah,4ch
  225.          int      21h
  226. endp     doneman
  227.  
  228. proc     get_fn   far
  229.          mov      ax,[psp_seg]
  230.          mov      es,ax
  231.          mov      di,80h
  232.          mov      cl,[es:di]
  233.          xor      ch,ch
  234.          cmp      cx,0
  235.          jnz      cmdlnok
  236.          mov      ax,0003h
  237.          int      10h
  238.          mov      ah,9
  239.          mov      dx,offset msg1_command_line
  240.          int      21h
  241.          mov      al,1
  242.          jmp      doneman
  243. cmdlnok: inc      di
  244. gcmdlp1: inc      di
  245.          mov      al,[es:di]
  246.          cmp      al,20
  247.          jz       gcmddn1
  248.          loop     gcmdlp1
  249. gcmddn1: mov      al,0
  250.          mov      [es:di],al
  251.          push     ds
  252.          mov      dx,82h
  253.          mov      ax,es
  254.          mov      ds,ax
  255.          mov      ax,3dc2h
  256.          int      21h
  257.          pop      ds
  258.          jnc      fok
  259. fnok:    mov      ah,9
  260.          mov      dx,offset msg2_fnf
  261.          int      21h
  262.          mov      al,2
  263.          jmp      doneman
  264. fok:     mov      [gfh],ax
  265.          mov      ax,4202h
  266.          mov      cx,0
  267.          mov      dx,0
  268.          mov      bx,[gfh]
  269.          int      21h
  270.          mov      [file_size_high],dx
  271.          mov      [file_size_low],ax
  272.          mov      ax,4200h
  273.          mov      cx,0
  274.          mov      dx,0
  275.          mov      bx,[gfh]
  276.          int      21h
  277.          ret
  278. endp     get_fn
  279. end      main
  280.